<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        Date.prototype.format = function() {
            const y = this.getFullYear() ;
            const m = this.getMonth() + 1 ;
            const d = this.getDate() ;

            const h = this.getHours() ;
            const min = this.getMinutes() ;
            const s = this.getSeconds() ;

            return `${y}-${m}-${d} ${h}:${min}:${s}`
        }


        const d = new Date() ;
        console.log(d.format());

    </script>
    
</body>
</html>